﻿using System;

// 矩形基类Rect
class Rect
{
    protected double width;
    protected double height;

    // 无参构造：宽高默认10
    public Rect()
    {
        width = 10;
        height = 10;
    }

    // 带参构造
    public Rect(double width, double height)
    {
        this.width = width;
        this.height = height;
    }

    // 求面积
    public double Area() => width * height;

    // 求周长
    public double Perimeter() => 2 * (width + height);
}

// 带位置的矩形类PlainRect（继承Rect）
class PlainRect : Rect
{
    private double startX;
    private double startY;

    // 无参构造：坐标、宽高默认0
    public PlainRect()
    {
        startX = 0;
        startY = 0;
        width = 0;
        height = 0;
    }

    // 带参构造
    public PlainRect(double startX, double startY, double width, double height)
    {
        this.startX = startX;
        this.startY = startY;
        this.width = width;
        this.height = height;
    }

    // 判断点是否在矩形内
    public bool IsInside(double x, double y)
    {
        // 点的x在[startX, startX+width]之间，y在[startY - height, startY]之间（假设y轴向上）
        return x >= startX && x <= startX + width && y >= startY - height && y <= startY;
    }
}

// 测试类
class Program
{
    static void Main(string[] args)
    {
        PlainRect rect = new PlainRect(10, 10, 20, 10);
        Console.WriteLine($"面积：{rect.Area()}");
        Console.WriteLine($"周长：{rect.Perimeter()}");
        Console.WriteLine($"点(25.5,13)是否在矩形内：{rect.IsInside(25.5, 13)}");
    }
}
